<template>
	<view class="px-2">
		<view class="my-2 flex align-center">最近更新</view>

		<view class="flex align-center mb-3" @click="open">
			<view class="">
				<image style="width: 150rpx; height: 150rpx" mode="aspectFill" :src="item.titlepic"></image>
			</view>
			<view class="pl-2 flex flex-column justify-around" style="height: 150rpx">
				<view class="" style="font-size: 40rpx">
					{{ item.title }}
				</view>
				<view class="" style="font-size: 30rpx; color: rgba(0, 0, 0, 0.2)">
					{{ item.description }}
				</view>
				<view class="" style="font-size: 30rpx; color: rgba(0, 0, 0, 0.2)">
					动态
					<text class="m-1">{{ item.dynamic }}</text>
					今日
					<text class="ml-1">{{ item.todayPostCount ? item.todayPostCount : 0 }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		item: {
			type: Object,
			default: () => {}
		},
		index: {
			type: Number,
			default: 0
		},
		chooes: {
			type: Boolean,
			default: () => {
				return false;
			}
		}
	},
	data() {
		return {};
	},
	methods: {
		open() {
			if (this.chooes) {
				uni.$emit('chooesTopic', {
					id: this.item.id,
					title: this.item.title
				});
				return uni.navigateBack({
					delta: 1
				});
			}
			uni.setStorageSync('item', JSON.stringify(this.item));
			uni.navigateTo({
				url: '/pages/topicDetail/topicDetail'
			});
		}
	}
};
</script>

<style></style>
